package cn.com.fuhuitong.main.mine.popup

import android.content.Context
import android.view.*
import android.view.animation.Animation
import cn.com.fuhuitong.R
import cn.com.fuhuitong.custom.AnimationTextSwitcher
import cn.com.fuhuitong.main.goods.entity.GoodsSpecsEntity
import cn.com.fuhuitong.main.goods.ui.activity.GoodsDetailsActivity
import kotlinx.android.synthetic.main.popup_setting_exit.view.*
import razerdp.basepopup.BasePopupWindow


class SettingExitPopupWindow(
    context: Context,
    val switch: (popup:SettingExitPopupWindow) -> Unit,
    val close: (popup:SettingExitPopupWindow) -> Unit,
    val cancel: (popup:SettingExitPopupWindow) -> Unit
) : BasePopupWindow(context) {

    init {
        popupGravity = Gravity.BOTTOM
        setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING)
        setAutoShowInputMethod(false)
    }

    override fun onCreateContentView(): View {
        return createPopupById(R.layout.popup_setting_exit)
    }

    override fun onViewCreated(contentView: View) {
        super.onViewCreated(contentView)
        contentView.text_setting_exit_switch.setOnClickListener {
            this.switch(this)
        }
        contentView.text_setting_exit_close.setOnClickListener {
            this.close(this)
        }
        contentView.text_setting_exit_cancel.setOnClickListener {
            this.cancel(this)
        }
    }

    override fun onCreateShowAnimation(width: Int, height: Int): Animation {
        return getTranslateVerticalAnimation(1F, 0F, 400)
    }

    override fun onCreateDismissAnimation(): Animation {
        return getTranslateVerticalAnimation(0F, 1F, 400)
    }

}